package com.bqtv.sport.ui.mine

import android.content.Context
import android.content.Intent
import android.text.Html
import android.view.View
import com.bqtv.sport.R
import com.bqtv.sport.app.AppActivity
import com.bqtv.sport.databinding.ActivityHtmlBinding

class HtmlActivity : AppActivity<ActivityHtmlBinding>() {
    companion object {
        var INTENT_TYPE = 1//1 登出账号  2 服务协议  3 隐私政策
        fun start(context: Context,type: Int) {
            val intent = Intent(context, HtmlActivity::class.java)
            intent.putExtra("type",type)
            context.startActivity(intent)
        }
    }

    override fun getViewBinding() = ActivityHtmlBinding.inflate(layoutInflater)

    override fun initView() {

    }

    override fun initData() {
        // 设置背景色
        binding.webContent.setBackgroundColor(0);
        // 设置透明度 范围：0-255
        binding.webContent.background?.alpha = 0;

        var dataDetail = ""
        when (intent.getIntExtra("type", INTENT_TYPE)) {
            1 -> {
                setTitle(R.string.logout_account)
                dataDetail=getString(R.string.logout_tip)
            }
            2 -> {
                setTitle(R.string.service_policy)
            }
            3 -> {
                setTitle(R.string.privacy_policy)
                dataDetail=getString(R.string.privacy_policy_tip)
            }
        }
        binding.webContent.loadDataWithBaseURL(
            null,
            dataDetail,
            "text/html",
            "utf-8",
            null
        )


        initListener()
    }

    private fun initListener() {

    }

    override fun onClick(view: View) {
        super.onClick(view)
        when (view) {

        }
    }
}